<?php

/**
 * This is the model class for table "{{history}}".
 *
 * The followings are the available columns in table '{{history}}':
 * @property integer $id
 * @property string $username
 * @property string $dates
 * @property string $model
 * @property string $oldconditions
 * @property string $conditions
 * @property string $oldcommedit
 * @property string $commedit
 * @property string $descredit
 * @property string $oldcommmark
 * @property string $commmark
 * @property string $descrmark
 * @property string $oldcomments
 * @property string $comments
 * @property string $descr
 */
class History extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return History the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{history}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('username, model, oldconditions, conditions, oldcommedit, commedit, oldcommmark, commmark, oldcomments, comments', 'length', 'max'=>100),
			array('dates', 'length', 'max'=>20),
			array('descredit, descrmark, descr', 'length', 'max'=>300),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, username, dates, model, oldconditions, conditions, oldcommedit, commedit, descredit, oldcommmark, commmark, descrmark, oldcomments, comments, descr', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'username' => 'Username',
			'dates' => 'Dates',
			'model' => 'Model',
			'oldconditions' => 'Oldconditions',
			'conditions' => 'Conditions',
			'oldcommedit' => 'Oldcommedit',
			'commedit' => 'Commedit',
			'descredit' => 'Descredit',
			'oldcommmark' => 'Oldcommmark',
			'commmark' => 'Commmark',
			'descrmark' => 'Descrmark',
			'oldcomments' => 'oldcomments',
			'comments' => 'comments',
			'descr' => 'descr',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('username',$this->username,true);
		$criteria->compare('dates',$this->dates,true);
		$criteria->compare('model',$this->model,true);
		$criteria->compare('oldconditions',$this->oldconditions,true);
		$criteria->compare('conditions',$this->conditions,true);
		$criteria->compare('oldcommedit',$this->oldcommedit,true);
		$criteria->compare('commedit',$this->commedit,true);
		$criteria->compare('descredit',$this->descredit,true);
		$criteria->compare('oldcommmark',$this->oldcommmark,true);
		$criteria->compare('commmark',$this->commmark,true);
		$criteria->compare('descrmark',$this->descrmark,true);
		$criteria->compare('oldcomments',$this->oldcomments,true);
		$criteria->compare('comments',$this->comments,true);
		$criteria->compare('descr',$this->descr,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}